<%@ page import="java.net.URLDecoder" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>login</title>
    <link href="css/login.css" rel="stylesheet">
</head>

<body>
<%

    Cookie[] cookies = request.getCookies();
    for (Cookie cookie : cookies) {
        if ("username".equals(cookie.getName())){
            String decode = URLDecoder.decode(cookie.getValue(), "utf-8");
            request.setAttribute("username",decode);
        }
        if ("password".equals(cookie.getName())){
            String decode = URLDecoder.decode(cookie.getValue(), "utf-8");
            request.setAttribute("password",decode);
        }
    }

%>
<div id="loginDiv">
    <form action="LoginServlet" id="form">
        <h1 id="loginMsg">LOGIN IN</h1>
        <div id="errorMsg">${err_msg}</div>

        <p>Username:<input id="username" name="username" type="text" value="${username}"></p>

        <p>Password:<input id="password" name="password" type="password" value="${password}"></p>
        <p>Remember:<input id="remember" name="remember" type="checkbox"></p>
        <div id="subDiv">
            <input type="submit" class="button" value="login up">
            <input type="reset" class="button" value="reset">&nbsp;&nbsp;&nbsp;
            <a href="register.jsp">没有账号？点击注册</a>
        </div>
    </form>
</div>

</body>
</html>